﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:po="http://schemas.microsoft.com/winfx/2006/xaml/presentation/options">

    <Style TargetType="{x:Type TabControl}">
        <Setter Property="OverridesDefaultStyle" Value="True" />
        <Setter Property="SnapsToDevicePixels" Value="True" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type TabControl}">
                    <Grid KeyboardNavigation.TabNavigation="Local">
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="*" />
                        </Grid.RowDefinitions>
                        <StackPanel Name="HeaderPanel"
                                    Grid.Row="0"
                                    Margin="0,0,4,-1"
                                    Panel.ZIndex="1"
                                    Background="Transparent"
                                    IsItemsHost="True"
                                    KeyboardNavigation.TabIndex="1"
                                    Orientation="Horizontal" />
                        <Border Name="Border"
                                Grid.Row="1"
                                Margin="1"
                                Background="Gray"
                                BorderBrush="Black"
                                BorderThickness="1"
                                CornerRadius="1"
                                KeyboardNavigation.DirectionalNavigation="Contained"
                                KeyboardNavigation.TabIndex="2"
                                KeyboardNavigation.TabNavigation="Local">
                            <ContentPresenter Name="PART_SelectedContentHost"
                                              Margin="2"
                                              ContentSource="SelectedContent" />
                        </Border>
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsEnabled" Value="False">
                            <Setter Property="Foreground" Value="#888888" />
                            <Setter TargetName="Border" Property="BorderBrush" Value="#AAAAAA" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <Style TargetType="{x:Type TabItem}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type TabItem}">
                    <Grid Margin="2,0,-12,0">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto" />
                            <ColumnDefinition Width="Auto" />
                            <ColumnDefinition Width="24" />
                        </Grid.ColumnDefinitions>
                        <Border x:Name="Border"
                                Grid.Column="0"
                                Grid.ColumnSpan="2"
                                Background="#FF333333"
                                CornerRadius="3,0,0,0" />
                        <Path x:Name="RoundedCorner"
                              Grid.Column="2"
                              Data="M6.5,2.6C4.767,0.973 2.509,0 0,0 0,0 0,19 0,19L23,19z"
                              Fill="#FF333333"
                              po:Freeze="True"
                              Stretch="Fill" />
                        <TextBlock x:Name="ContentSite"
                                   Margin="12,2,12,2"
                                   HorizontalAlignment="Center"
                                   VerticalAlignment="Center"
                                   Text="{Binding Keyword}"
                                   TextElement.Foreground="White" />
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsSelected" Value="True">
                            <Setter Property="Panel.ZIndex" Value="100" />
                            <Setter TargetName="Border" Property="Background" Value="Gray" />
                            <Setter TargetName="RoundedCorner" Property="Fill" Value="Gray" />
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="False">
                            <Setter TargetName="Border" Property="Background" Value="#EEEEEE" />
                            <Setter TargetName="RoundedCorner" Property="Fill" Value="#EEEEEE" />
                            <Setter Property="Foreground" Value="#888888" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

</ResourceDictionary>